//
//  AnchorCollectionViewCell.m
//  MarianasTrench
//
//  Created by 付建国 on 16/3/18.
//  Copyright © 2016年 王爵. All rights reserved.
//

#import "AnchorCollectionViewCell.h"

@interface AnchorCollectionViewCell ()

@property (nonatomic, strong) UIImageView *imageV;

@property (nonatomic, strong) UILabel *nameL;

@end
@implementation AnchorCollectionViewCell

- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        [self createSubViews];
    }
    return self;
}
// 重写setter方法
- (void)setModel:(ExampleModel *)model{
    _model = model;
    [self fuzhi];
}
- (void)fuzhi{
//    [self.imageV sd_setImageWithURL:[NSURL URLWithString:_model.smallLogo]];
    dispatch_async(dispatch_get_main_queue(), ^{
        
        [self.imageV HANDLEIMAGE(_model.smallLogo)];
    });
    
    self.nameL.text = _model.nickname;
    self.nameL.textAlignment = NSTextAlignmentCenter;
    self.nameL.font = [UIFont systemFontOfSize:19];
    self.nameL.textColor = [UIColor orangeColor];
    
}


- (void)createSubViews{
    self.imageV = [[UIImageView alloc] init];
    [self.contentView addSubview:_imageV];
    
    self.nameL = [[UILabel alloc] init];
    [self.contentView addSubview:_nameL];
    
}
// 布局
- (void)applyLayoutAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes{
    [super applyLayoutAttributes:layoutAttributes];
    self.imageV.frame = CGRectMake(0, 0, layoutAttributes.frame.size.width, layoutAttributes.frame.size.height - 30);
    
    self.nameL.frame = CGRectMake(0, layoutAttributes.frame.size.height - 30, layoutAttributes.frame.size.width, 30);
}















@end
